﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// NotReviewedButNeeded
#pragma once
#include "GcmpDevService.h"

namespace gcmp
{
    /// \brief 崩溃工具类
    class GCMP_DEV_SERVICE_EXPORT CrashHelper
    {
    public:
        /// \brief 获得崩溃工具类实例
        /// \return 获得的崩溃工具类实例
        static CrashHelper* GetInstance();

        /// \brief 使程序立即崩溃，并打印崩溃信息到日志中
        /// \param expression 造成崩溃的函数表达式
        /// \param fileName 崩溃所在的文件名
        /// \param line 崩溃所在的行数
        /// \param function 崩溃所在的函数
        /// \param crashTips 可能引起的崩溃原因提示信息
        /// \return void
        void Crash(const std::wstring &expression, const std::wstring &fileName, int line, const std::wstring &function, const std::wstring &crashTips) const;

    private:
        /// \brief 构造函数
        CrashHelper() {}

        /// \brief 析构函数
        ~CrashHelper() {}
    };
}
